home *** CD-ROM | disk | FTP | other *** search
/ 500 MB Nyheder Direkte fra Internet 2 / 500 MB nyheder direkte fra internet CD 2.iso / start / data / text / fun.txt < prev    next >
Text File  |  1994-09-21  |  85KB  |  1,875 lines

  1.  
  2.        ENTER BASIC
  3.   To program the computer, you must use a language that the 
  4. computer understands. Most computers understand a language called 
  5. BASIC, which is a small part of English.
  6.   BASIC was invented by two Dartmouth College professors (John 
  7. Kemeny and Tom Kurtz) in 1964. Later they improved it. Today, 
  8. BASIC consists of words such as PRINT, GO, TO, INPUT, IF, and 
  9. THEN.
  10.   Here's how to program the computer by using those BASIC words.
  11.  
  12.      Microsoft BASIC
  13.   Different computers speak different dialects of BASIC. The most 
  14. popular dialect was invented in 1975 by a 19-year-old kid, Bill 
  15. Gates. Since he developed software for microcomputers, he called 
  16. himself Microsoft and called his BASIC dialect Microsoft BASIC.
  17.   Since Microsoft BASIC is so wonderful, all the popular computer 
  18. companies paid him to make their computers understand Microsoft 
  19. BASIC. That's right: IBM, Apple, Commodore, Tandy, Atari, Texas 
  20. Instruments, and hundreds of other computer companies all had to 
  21. pay off Bill.
  22.   Microsoft BASIC has become so popular that Bill had to hire 
  23. hundreds of employees to help him fill all the orders. Microsoft 
  24. Incorporated has become a multi-billion-dollar company, and Bill 
  25. has become a famous billionaire, the wealthiest person in America 
  26. ___ he's still just in his 30's!
  27.   Over the years, Bill gradually improved Microsoft BASIC. Some 
  28. computers use old versions of Microsoft BASIC; other computers 
  29. use his latest improvements.
  30.                                         What's in this chapter?
  31.                              This chapter on BASIC explains 
  32. Modern Microsoft BASIC, whose popular commands and functions are 
  33. explained on the following pages:
  34. Command                                    What the computer will 
  35. do                                                               
  36. Page                                                               
  37. Similar to
  38. BEEP                                       hum for a quarter of a 
  39. second                                                           
  40. 373                                                                
  41. SOUND, PLAY
  42. CIRCLE (100,100),50                        draw a circle at 
  43. (100,100) with radius 50                                         
  44. 372                                                                
  45. LINE, PAINT
  46. CLOSE                                      put finishing touches 
  47. on the data files                                                
  48. 415                                                                
  49. OPEN
  50. CLS                                        clear the screen, so 
  51. it becomes blank                                                 
  52. 333                                                                
  53. NEW, LOCATE
  54. DATA MEAT,POTATOES                         use this list of data: 
  55. MEAT, POTATOES                                                   
  56. 350                                                                
  57. READ, RESTORE
  58. DATE$="01-24-1996"                         set the clock/calendar 
  59. to 01-24-1996                                                    
  60. 395                                                                
  61. TIME$=
  62. DEFINT A-Z                                 make all the numeric 
  63. variables be integers                                            
  64. 397                                                                
  65. X=
  66. DELETE 30-80                               delete lines 30-80 
  67. from the program                                                 
  68. 332                                                                
  69. LIST, EDIT
  70. DIM X$(7)                                  make X$ be a list of 7 
  71. strings                                                          
  72. 379                                                                
  73. X=
  74. EDIT 30                                    edit line 30 of the 
  75. program                                                          
  76. 332                                                                
  77. LIST, DELETE
  78. END                                        skip the rest of the 
  79. program                                                          
  80. 336                                                                
  81. STOP
  82. FIELD 1, 30 AS X$                          let file#1's record be 
  83. 30 bytes and called X$                                           
  84. 417                                                                
  85. GET, PUT
  86. FILES                                      print the names of all 
  87. the disk files                                                   
  88. 336                                                                
  89. SAVE, LOAD
  90. FOR X = 1 TO 100                           repeat the lines 
  91. underneath, 100 times                                            
  92. 355                                                                
  93. NEXT
  94. GET 1,7                                    from file#1, get the 
  95. 7th record                                                       
  96. 417                                                                
  97. FIELD, PUT
  98. GO TO 10                                   skip to line 10 of the 
  99. program                                                          
  100. 334                                                                
  101. GOSUB
  102. GOSUB 1000                                 do the subroutine that 
  103. begins at line 1000                                              
  104. 376                                                                
  105. RETURN
  106. IF A$="FINE" THEN PRINT                    if A$ is ``FINE'', 
  107. print a blank line                                               
  108. 345                                                                
  109. ON N GO TO
  110. INPUT "WHAT NAME";N$                       ask ``WHAT NAME?'' and 
  111. get answer N$                                                    
  112. 341                                                                
  113. LINE INPUT
  114. INPUT#1, A$                                input from file#1 the 
  115. value of A$                                                      
  116. 415                                                                
  117. INPUT
  118. KILL "JOE"                                 erase the file JOE 
  119. from the disk                                                    
  120. 337                                                                
  121. FILES, NEW
  122. LINE (0,0)-(100,100)                       draw a line from (0,0) 
  123. to (100,100)                                                     
  124. 372                                                                
  125. PLOT, CIRCLE
  126. LINE INPUT "TYPE IT";N$                    say ``TYPE IT'' and 
  127. grab whole line as input                                         
  128. 407                                                                
  129. INPUT
  130. LIST                                       print a list of all 
  131. the program's lines                                              
  132. 331                                                                
  133. LLIST, EDIT
  134. LLIST                                      copy all the program's 
  135. lines onto paper                                                 
  136. 333                                                                
  137. LIST, PRINT#1
  138. LOAD "JOE"                                 copy the program JOE 
  139. from disk to RAM                                                 
  140. 337                                                                
  141. SAVE, RUN
  142. LOCATE 3,7                                 move to the 3rd line 
  143. of screen, 7th position                                          
  144. 371                                                                
  145. PRINT, CLS
  146. LPRINT "I LOVE YOU"                        print ``I LOVE YOU'' 
  147. on paper                                                         
  148. 333                                                                
  149. PRINT, PRINT#1
  150. LSET X$="I LOVE LUCY"                      make field variable X$ 
  151. be ``I LOVE LUCY''                                               
  152. 417                                                                
  153. FIELD, PUT
  154. MID$(A$,2)="OWL"                           change the middle of 
  155. A$ to ``OWL''                                                    
  156. 394                                                                
  157. X=
  158. NEW                                        start a new program   
  159. 328                                                                
  160. RUN, DELETE
  161. NEXT X                                     repeat the lines 
  162. above, for the next X                                            
  163. 355                                                                
  164. FOR
  165. ON ERROR GO TO 1000                        if the lines below 
  166. cause errors, go to 1000                                         
  167. 414                                                                
  168. RESUME
  169. ON N GO TO 80,100,20,350                   go to 80, 100, 20, or 
  170. 350, depending on N                                              
  171. 413                                                                
  172. ON N GOSUB
  173. ON N GOSUB 80,100,20,350                   gosub 80, 100, 20, or 
  174. 350, depending on N                                              
  175. 413                                                                
  176. ON N GO TO
  177. OPEN "S" FOR OUTPUT AS 1                   create a data file 
  178. called ``S''; output to it                                       
  179. 415                                                                
  180. CLOSE
  181. PAINT (100,101)                            fill in the shape that 
  182. surrounds (100,101)                                              
  183. 372                                                                
  184. LINE, CIRCLE
  185. PLAY "CDG#B-A"                             play this music: C, D, 
  186. G sharp, B flat, A                                               
  187. 374                                                                
  188. SOUND, BEEP
  189. PLOT (100,100)                             put a dot at the point 
  190. (100,100)                                                        
  191. 372                                                                
  192. LINE, CIRCLE
  193. POKE 7512,14                               into memory cell 
  194. #7512, put the number 14                                         
  195. 414                                                                
  196. X=
  197. PRINT 5+2                                  print the answer to 
  198. 5+2                                                              
  199. 326                                                                
  200. ?
  201. PRINT USING "##.#"; 30/7                   print 30/7, rounded to 
  202. one decimal place                                                
  203. 374                                                                
  204. PRINT
  205. PRINT#1, "EAT"                             print onto file#1 the 
  206. word ``EAT''                                                     
  207. 415                                                                
  208. PRINT, LPRINT
  209. PUT 1,50                                   in file#1, change the 
  210. 50th record                                                      
  211. 417                                                                
  212. FIELD, GET
  213. RANDOMIZE                                  make random numbers be 
  214. unpredictable                                                    
  215. 388                                                                
  216. X=
  217. READ A$                                    get a string from the 
  218. DATA and call it A$                                              
  219. 350                                                                
  220. DATA, RESTORE
  221. RENAME "JOE" TO "FRED"                     find the file JOE and 
  222. rename it ``FRED''                                               
  223. 337                                                                
  224. FILES, SAVE
  225. RENUM                                      renumber all the 
  226. program's lines, by 10's                                         
  227. 367                                                                
  228. LIST, EDIT
  229. RESTORE                                    go back to the 
  230. beginning of the data                                            
  231. 351                                                                
  232. READ, DATA
  233. RESUME 30                                  end the error trap, by 
  234. going to line 30                                                 
  235. 414                                                                
  236. ON ERROR GO TO
  237. RETURN                                     return to the main 
  238. routine (from subroutine)                                        
  239. 376                                                                
  240. GOSUB
  241. RUN                                        obey all the program's 
  242. instructions now                                                 
  243. 328                                                                
  244. LIST, LOAD
  245. SAVE "JOE"                                 copy the program to 
  246. disk and call it ``JOE''                                         
  247. 336                                                                
  248. FILES, LOAD
  249. SOUND 440,18.2                             make a sound of 440 
  250. hertz, for 1 second                                              
  251. 373                                                                
  252. PLAY, BEEP
  253. STOP                                       stop the program and 
  254. print a message                                                  
  255. 336                                                                
  256. END
  257. SWAP A,B                                   make A and B swap 
  258. values with each other                                           
  259. 409                                                                
  260. X=
  261. TIME$="13:45:07"                           set the clock to 7 
  262. seconds after 13:45                                              
  263. 395                                                                
  264. DATE$=
  265. X=47                                       make X stand for the 
  266. number 47                                                        
  267. 337                                                                
  268. INPUT, POKE
  269. ? 5+2                                      print the answer to 
  270. 5+2                                                              
  271. 326                                                                
  272. PRINT
  273. 'THIS PROGRAM IS DUMB                      note that this program 
  274. is dumb                                                          
  275. 367                                                                
  276. PRINT
  277.  
  278. Function      Meaning         Value   PageSimilar to
  279. ABS(-7)       absolute value of -77   386INT, SGN
  280. ASC("A")      ASCII code number for A65392CHR$
  281. ATN(1)/D      arctangent of 1, in degrees45396TAN
  282. CHR$(65)      65th ASCII character``A''392ASC
  283. COS(60*D)     cosine of 60 degrees.5  396SIN, TAN
  284. CVD("RAT NAN~")convert to double-precision.2014209944946413417MKD
  285. $
  286. CVI("ME")     convert to integer17741 417MKI$
  287. CVS("NAN~")   convert to single-precision.201421417MKS$
  288. DATE$         today's date    varies  395TIME$
  289. EOF(1)        test whether at end of file#1varies416LOF
  290. EXP(1)        e raised to the first power2.718282384LOG, SQR
  291. INPUT$(4)     4 characters that are inputvaries407STICK
  292. INSTR("NEEDED","ED")position of ED in NEEDED3395other INSTR
  293. INSTR(4,"NEEDED","ED")search from the 4th character5395other 
  294. INSTR
  295. INT(17.9)     turn into an integer17  386ABS, SGN
  296. LEFT$("SMART",2)left 2 characters of SMART``SM''394RIGHT$, MID$
  297. LEN("SMART")  length of SMART 5       394RIGHT$, MID$
  298. LOC(1)        location of record in file#1varies417LOF
  299. LOF(1)        length of file#1, in bytesvaries416EOF
  300. LOG(2.718282) logarithm base e1       385EXP
  301. MID$("SMART",2)begin at the 2nd character``MART''394other MID$
  302. MID$("SMART",2,3)begin at the 2nd, take 3``MAR''394other MID$
  303. MKD$(.2014209944946413)make the double a string``RAT NAN~''417CVD
  304. MKI$(17741)   make the integer a string``ME''417CVI
  305. MKS$(.201421) make the single a string``NAN~''417CVS
  306. MOUSE(1)      how far mouse to rightvaries408STICK
  307. PEEK(7512)    peek at memory cell #7512varies414RND
  308. RIGHT$("SMART",2)rightmost 2 characters``RT''394MID$
  309. RND           random decimal  varies  391other RND
  310. RND(5)        random integer from 1 to 5varies388other RND
  311. SGN(-546)     sign of -546    -1      386ABS, INT
  312. SIN(30*D)     sine of 30 degrees.5    396COS, TAN
  313. SQR(9)        square root of 93       384EXP, LOG
  314. STICK(0)      how far joystick to rightvaries408MOUSE
  315. STR$(81.4)    turn 81.4 into a string`` 81.4''395VAL
  316. STRING$(5,"B")a string of 5 B's``BBBBB''395other STRING$
  317. STRING$(5,66) 66th ASCII character, 5 times``BBBBB''395other 
  318. STRING$
  319. TAN(45*D)     tangent of 45 degrees1  396ATN
  320. TIME$         current time of dayvaries395TIMER, DATE$
  321. TIMER         # of seconds since midnightvaries395TIME$, DATE$
  322. VAL("72.6")   remove the quotation marks72.6395STR$
  323.   All popular microcomputers use either Modern Microsoft BASIC or 
  324. a slight variation of it.
  325.   At the end of this BASIC chapter is an amazing appendix called 
  326. ``Versions of BASIC''. It explains the versions of BASIC used by 
  327. IBM, Commodore, Apple, Tandy, and dozens of other manufacturers, 
  328. including yours. It reveals the subtle ways that your computer's 
  329. BASIC differs from Modern Microsoft BASIC.
  330.   If you don't have a computer yet, ignore the appendix: read 
  331. just the main text, which explains Modern Microsoft BASIC.
  332.   If you do have access to a computer, read the main text (which 
  333. explains Modern Microsoft BASIC); but before trying the examples 
  334. on your computer, peek at the appendix to see how your computer's 
  335. BASIC differs from Modern Microsoft BASIC. To reach that appendix 
  336. easily, put a bookmark now at the following page:
  337. Kind of computer you have Where to put the bookmark
  338. IBM PC or any computer that uses IBM PC softwarepage 422
  339. Apple Mac                 page 427
  340. Apple 2, 2+, 2e, 2c, 2c+, or 2GSpage 431
  341. Commodore                 page 438
  342. Tandy's Radio Shack TRS-80 model 4page 443
  343. Tandy's Radio Shack TRS-80 Color Computerpage 445
  344. other computer            page 449
  345.   If you ever get confused about how to program your computer, 
  346. phone me at 617-666-2666. I'll help you, free!
  347.  
  348.                   The keyboard
  349.   Each year, manufacturers improve their keyboards. I expect that 
  350. someday most manufacturers will use the Walter keyboard, which I 
  351. invented several years ago. It looks like this:
  352. ┌──────┬───────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────
  353. ─┬──────┐
  354. │Clear │ClrDoc │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ 
  355. │BackWd│DeleWd│
  356. │Help  │Escape │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - 
  357. │Backsp│Delete│
  358. ├──────┼───────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───
  359. ─┴┬─────┤
  360. │  \   │    │    │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ + │  {  
  361. │  }  │
  362. │LfTab │   Tab   │   │   │   │   │   │   │   │   │   │   │ = │  [  
  363. │  ]  │
  364. ├──────┼─────────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──
  365. ──┴─────┤
  366. │  `   │    ~     │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │          
  367. │Functn│ Control  │   │   │   │   │   │   │   │   │   │ ; │ ' │  
  368. Enter   │
  369. ├──────┼──────┬───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──
  370. ─┬──────┤
  371. │Boot  │PrtDoc│     │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │     
  372. │ Top  │
  373. │Break │Print │Shift│   │   │   │   │   │   │   │ , │ . │ / 
  374. │Shift│     │
  375. ├──────┼──────┼─────┴┬──┴───┼───┴───┴───┴───┴───┼───┴─┬─┴───┼────
  376. ─┼──────┤
  377. │     │     │     │     │                   │Copy 
  378. │LfMar│RtMar│Bottom│
  379. │Pause │ Echo │ Caps │Insert│       Space       │Move │    │  ■  
  380. │     │
  381. └──────┴──────┴──────┴──────┴───────────────────┴─────┴─────┴────
  382. ─┴──────┘
  383.   Now I'm going to explain how to use the most important keys. 
  384. But don't touch the keys on your keyboard until you've read the 
  385. next section (which is called ``Get Started'') and the ``Versions 
  386. of BASIC'' appendix (which reveals how your keyboard differs from 
  387. the Walter keyboard).
  388.   Numbers Look at the Walter keyboard. The top row of keys 
  389. contains the numbers.
  390.   Don't confuse 1 with I; the number 1 is in the top row. Don't 
  391. confuse zero with the letter O; the number zero is in the top 
  392. row.
  393.   (On older keyboards, the zero has a slash through it, like 
  394. this: O. That's called a slashed zero or a Swedish zero.)
  395.   The SHIFT key One of the keys looks like this:
  396. ┌───┐
  397. │ $ │
  398. │ 4 │
  399. └───┘
  400. If you press that $4 key, you'll type a 4. Here's how to type a 
  401. dollar sign instead: hold down the SHIFT key; and while you keep 
  402. holding down the SHIFT key, tap the $4 key. Here's the general 
  403. rule: if a key has two symbols on it, and you want to type the 
  404. top symbol, hold down the SHIFT key.
  405.   About the SHIFT key, beginners often make two boo-boos. The 
  406. first boo-boo is forgetting to press it. For example, suppose you 
  407. want to type a dollar sign, and you press the $4 key but forget 
  408. to hold down the SHIFT key; then you'll be typing a 4 instead.
  409.   The other boo-boo is trying to hit the SHIFT key and another 
  410. key at exactly the same time. You can't do it; it's impossible; 
  411. you'll wind up hitting one key before the other. The trick is to 
  412. hold down the SHIFT key first; and while you keep holding it 
  413. down, give the other key a light tap.
  414.   Beginners often make those boo-boos. When they realize their 
  415. mistakes, they say ``Oh, shit!'' That's why programmers call it 
  416. the ``shit'' key.
  417.   The keyboard contains two SHIFT keys. They serve the same 
  418. purpose as each other. Use whichever SHIFT key makes your fingers 
  419. feel more comfortable.
  420.   The CAPS key If you tap the CAPS key, the computer will 
  421. automatically capitalize all the letters you type. For example, 
  422. if you tap the CAPS key and then press the M and E keys, the 
  423. screen will show a capitalized ME. The computer will continue to 
  424. capitalize all the letters, until you tell the computer to stop 
  425. capitalizing.
  426.   To make the computer stop capitalizing, just tap the CAPS key 
  427. again. After you've told the computer to stop capitalizing, 
  428. pressing the M and E keys make the screen show a small me ___ 
  429. unless you simultaneously hold down the SHIFT key.
  430.   The BACKSPACE key The BACKSPACE key says BACKSP on it. If you 
  431. make a typing mistake, erase the mistake by pressing the 
  432. BACKSPACE key, which makes the computer erase the last character 
  433. you typed. To erase two characters, press the BACKSPACE key 
  434. twice.
  435.   (On older keyboards, the BACKSPACE key has a left-arrow on it, 
  436. like this: . To find out about your keyboard's BACKSPACE key, 
  437. check the ``Versions of BASIC'' appendix.)
  438.  
  439.   The ENTER key The most important key is the ENTER key. When 
  440. using BASIC, press the ENTER key at the end of every line you 
  441. type. The ENTER key takes the line you've typed and enters that 
  442. line into the computer, so that the computer reads the line.
  443.   The computer ignores what you type, until you press the ENTER 
  444. key. If you forget to press the ENTER key at the end of the line, 
  445. the computer doesn't read what you typed, and so the computer 
  446. doesn't do anything, and you wonder why the computer seems 
  447. broken.
  448.   (On older keyboards, the ENTER key is called the RETURN key.)
  449.  
  450.                    Get started
  451.   Make sure the various parts of your computer system are 
  452. correctly attached to each other. Then turn on the power. If your 
  453. computer is modern (and uses Microsoft BASIC), it will say:
  454. OK
  455.   (Older computers don't say OK. Instead, they say READY or print 
  456. a bracket. For further details about your computer, read the 
  457. ``Versions of BASIC'' appendix.)
  458.   Be bold In science fiction, computers blow up; in real life, 
  459. they never do. No matter what keys you press, no matter what 
  460. commands you type, you won't hurt the computer. The computer is 
  461. invincible! So go ahead and experiment. If it doesn't like what 
  462. you type, it will gripe at you, but so what?
  463.   Troubles When you try using the computer, you'll have trouble 
  464. ___ because you're making a mistake, or the computer is broken, 
  465. or the computer is weird and works differently from the majority 
  466. of computers discussed in this book. (Each computer has its own 
  467. ``personality'', its own quirks.)
  468.   Whenever you have trouble, laugh about it, and say, ``Oh, boy! 
  469. Here we go again!'' (If you're Jewish, you can say all that more 
  470. briefly, in one word: ``Oy!'') Then get some help.
  471.   Get help For further help with your computer, read the 
  472. ``Versions of BASIC'' appendix. For even more help, read the 
  473. beginner's manual that came with your computer, or ask the genie 
  474. who gave you the computer (your salesperson or parent or boss or 
  475. teacher or friend).
  476.   If you're sitting near computers in your office, school, or 
  477. home, and other people are nearby, ask them for help. They'll 
  478. gladly answer your questions because they like to show off and 
  479. because the way they got to know the answers was by asking.
  480.   Computer folks like to explain computers, just as priests like 
  481. to explain religion. Remember: you're joining a cult! Even if you 
  482. don't truly believe in ``the power and glory of computers'', at 
  483. least you'll have a few moments of weird fun. So play along with 
  484. the weird computer people, boost their egos, and they'll help you 
  485. get through your initiation rite. Above all, assert yourself, and 
  486. ask questions. ``Shy guys finish last.''
  487.   When dealing with the computer and the people who surround it, 
  488. be friendly but assertive. To make sure you get your money's 
  489. worth from a computer course, ask your teachers and coworkers 
  490. questions, questions, questions! If you're using a computer that 
  491. you won, get help from the person who gave it to you.
  492.   Your town probably has a computer club. (To find out, ask the 
  493. local schools and computer stores.) Join the club, and tell the 
  494. members you'd like help with your computer. Probably some 
  495. computer hobbyist will help you.
  496.   And remember ___ you can call me anytime at 617-666-2666, and 
  497. I'll help you, free!
  498.  
  499.  
  500.                 MATH
  501.   Let's try to make the computer print the answer to 5+2. (And 
  502. let's hope the computer says 7.)
  503.   Type this:
  504. PRINT 5+2
  505.   Type that carefully! Here's how. . . . 
  506.   First, type the word PRINT, by pressing the P key, then the R 
  507. key, then I, then N, then T. (Since most computers don't care 
  508. about capitalization, don't bother pressing the SHIFT key.)
  509.   After typing the word PRINT, type a blank space (by pressing 
  510. the SPACE bar). Then press the 5 key. Then type a plus sign, but 
  511. be careful: on most keyboards, the plus sign is on the top part 
  512. of a key; so to type the plus sign, you must hold down the SHIFT 
  513. key. Then type the 2.
  514.   When you've finished typing that line, press the ENTER key, 
  515. which makes the computer read what you've typed.
  516.   Then the computer will print the answer:
  517.  7
  518.   If your computer prints a wrong answer instead or says ERROR, 
  519. you made a typing mistake. Find your mistake (by looking at the 
  520. screen), and then try again to type:
  521. PRINT 5+2
  522.   Underneath the answer, the computer will print the word OK (or 
  523. some old-fashioned word, such as READY). That means it's okay for 
  524. you to feed the computer the next problem; the computer's ready 
  525. for another problem.
  526.   If you want to subtract 3 from 7, type this:
  527. PRINT 7-3
  528. (To type the minus sign, you do not press the SHIFT key.) When 
  529. you've finished typing that line, remember to press the ENTER 
  530. key, which makes the computer read that line and print the 
  531. answer. The computer will print:
  532.  4
  533.   You can use decimal points and negative numbers. For example, 
  534. if you type this ___ 
  535. PRINT -26.3+1
  536. the computer will print:
  537. -25.3
  538.  
  539.            Multiplication
  540.   To multiply, use an asterisk. To multiply 2 by 6, type this:
  541. PRINT 2*6
  542. The computer will print:
  543.  12
  544.  
  545.               Division
  546.   To divide, use a slash. So to divide 8 by 4, type this:
  547. PRINT 8/4
  548. The computer will print:
  549.  2
  550.  
  551.             Question mark
  552.   If you're too lazy to type the word PRINT, type a question mark 
  553. instead. For example, instead of typing ___ 
  554. PRINT 5+2
  555.  
  556. you can type:
  557. ? 5+2
  558.                                          The question mark is an 
  559. abbreviation. It stands for the word PRINT.
  560.                                          If you wish, think of 
  561. the question mark as standing for the word ``What's''. For 
  562. example, if you want to ask the computer ``What's 5+2'', type 
  563. this:
  564. ? 5+2
  565.  
  566.                                                 Huge & tiny numbers
  567.                                          Do not put commas in 
  568. large numbers. To write four million, do not write 4,000,000; 
  569. instead, write 4000000.
  570.                                          If the computer's answer 
  571. is huge (more than a million) or tiny (less than .01), the 
  572. computer might print the answer strangely. Here's how. . . . 
  573.                                          E notation The computer 
  574. might print the letter E, which means ``move the decimal point''.
  575.                                          For example, suppose the 
  576. computer says the answer to a problem is:
  577.  8.51673E+12
  578. The E means, ``move the decimal point''. The plus sign means, 
  579. ``towards the right''. Altogether, the E+12 means, ``move the 
  580. decimal point towards the right, 12 places.'' So look at 8.51673, 
  581. and move the decimal point towards the right, 12 places; you get 
  582. 8516730000000.
  583.                                          So when the computer 
  584. says the answer is 8.51673E+12, the computer really means the 
  585. answer is 8516730000000, approximately. The exact answer might be 
  586. 8516730000000.2 or 8516730000000.79 or some similar number, but 
  587. the computer prints just an approximation.
  588.                                          Suppose your computer 
  589. says the answer to a problem is:
  590.  9.26E-04
  591. After the E, the minus sign means, ``towards the left''. So look 
  592. at 9.26, and move the decimal point towards the left, 4 places. 
  593. You get:
  594. .000926
  595. So when the computer says the answer is 9.26E-04, the computer 
  596. really means the answer is:
  597. .000926
  598.                                          You'll rarely see E 
  599. notation: the computer uses it only if an answer is huge (many 
  600. millions) or tiny (tinier than .01). But when the computer does 
  601. use E notation, remember to move the decimal point!
  602.                                          The highest number The 
  603. highest number the computer can handle is about 1E38, which is 1 
  604. followed by 38 zeros, like this:
  605. 100000000000000000000000000000000000000
  606. If you try to go much higher, the computer will say:
  607. OVERFLOW ERROR
  608.                                          The tiniest decimal The 
  609. tiniest decimal the computer can handle is about 1E-38, which is 
  610. a decimal point followed by 38 digits, 37 of which are zeros, 
  611. like this:
  612. .00000000000000000000000000000000000001
  613. If you try to go tinier, the computer will have an ``underflow 
  614. error'' and will ``fake'' the answer: it will give zero instead 
  615. of the correct answer.
  616.          Order of operations
  617.   What does ``2 plus 3 times 4'' mean? The answer depends on who 
  618. you ask.
  619.   To a clerk, it means ``start with 2 plus 3, then multiply by 
  620. 4''; that makes 5 times 4, which is 20. But to a scientist, ``2 
  621. plus 3 times 4'' means something different: it means ``2 plus 
  622. three fours'', which is 2+4+4+4, which is 14.
  623.   Since computers were invented by scientists, computers think 
  624. like scientists. If you type ___ 
  625. PRINT 2+3*4
  626. the computer will think you mean ``2 plus three fours'', so it 
  627. will do 2+4+4+4 and print this answer:
  628.  14
  629. The computer will not print the clerk's answer, which is 20. So 
  630. if you're a clerk, tough luck!
  631.   Scientists and computers follow this rule: do multiplication 
  632. and division before addition and subtraction. So if you type ___ 
  633. PRINT 2+3*4
  634. the computer begins by hunting for multiplication and division. 
  635. When it finds the multiplication sign between the 3 and the 4, it 
  636. multiplies 3 by 4 and gets 12, like this:
  637. PRINT 2+3*4
  638.  
  639.         12
  640. So the problem becomes 2+12, which is 14, which the computer 
  641. prints.
  642.   For another example, suppose you type:
  643. PRINT 10-2*3+72/9*5
  644. The computer begins by doing all the multiplications and 
  645. divisions. So it does 2*3 (which is 6) and does 72/9*5 (which is 
  646. 8*5, which is 40), like this:
  647. PRINT 10-2*3+72/9*5
  648.  
  649.           6    40
  650. So the problem becomes 10-6+40, which is 44, which is the answer 
  651. the computer prints.
  652.   Parentheses  You can use parentheses the same way as in 
  653. algebra. For example, if you type ___ 
  654. PRINT 5-(1+1)
  655. the computer will compute 5-2 and print:
  656.  3
  657.   You can put parentheses inside parentheses. If you type ___
  658. PRINT 10-(5-(1+1))
  659. the computer will compute 10-(5-2), which is 10-3, and will 
  660. print:
  661.  7
  662.  
  663.  
  664.                STRINGS
  665.                                          Let's make the computer 
  666. fall in love. Let's make it say, ``I love you''.
  667.                                          Type this:
  668. PRINT "I LOVE YOU"
  669.                                          Type it carefully. Begin 
  670. by typing the word PRINT. (If you're lazy, type a question mark 
  671. instead.) Then press the SPACE bar. Then type a quotation mark, 
  672. but be careful: on most keyboards, the quotation mark is on the 
  673. top part of a key; so to type the quotation mark, you must hold 
  674. down the SHIFT key. Then type I LOVE YOU. Then type another 
  675. quotation mark.
  676.                                          At the end of the line, 
  677. press the ENTER key. The computer will obey your command; it will 
  678. print:
  679. I LOVE YOU
  680.                                          You can change the 
  681. computer's personality. For example, if you give this command ___ 
  682. PRINT "I HATE YOU"
  683. the computer will reply:
  684. I HATE YOU
  685.                                          Notice that to make the 
  686. computer print a message, you must put the message between 
  687. quotation marks. The quotation marks make the computer copy the 
  688. message without worrying about what the message means. For 
  689. example, if you misspell ``I love you'', and type ___ 
  690. PRINT "AIEEE LUF YA"
  691. the computer will still copy the message (without worrying about 
  692. what it means); the computer will print:
  693. AIEEE LUF YA
  694.  
  695.                                                       Jargon
  696.                                          The word ``JOY'' 
  697. consists of 3 characters: J and O and Y. Programmers say that the 
  698. word ``JOY'' is a string of 3 characters.
  699.                                          A string is any 
  700. collection of characters, such as ``JOY'' or ``I LOVE YOU'' or 
  701. ``AIEEE LUF YA'' or ``76 TROMBONES'' or ``GO AWAY!!!'' or ``XYPW 
  702. EXR///746''. The computer will print whatever string you wish, 
  703. but remember to put the string in quotation marks.
  704.  
  705.                                               Strings versus numbers
  706.                                          The computer can handle 
  707. two types of expressions: strings and numbers. Put strings (such 
  708. as ``JOY'' and ``I LOVE YOU'') in quotation marks. Numbers (such 
  709. as 2+2) do not go in quotation marks.
  710.                     Accidents
  711.   Suppose you accidentally put the number 2+2 in quotation marks, 
  712. like this:
  713. PRINT "2+2"
  714. The quotation marks make the computer think ``2+2'' is a string 
  715. instead of a number. Since the computer thinks ``2+2'' is a 
  716. string, it copies the string without analyzing what it means; the 
  717. computer will print:
  718. 2+2
  719. It will not print 4.
  720.   Suppose you accidentally forget to put the string ``I LOVE 
  721. YOU'' in quotation marks, and type this instead:
  722. PRINT I LOVE YOU
  723. Since you forgot the quotation marks, the computer thinks the I 
  724. LOVE YOU is a weird number instead of a string; but the computer 
  725. doesn't know what kind of weird number it is since the computer 
  726. doesn't know the meaning of love. Whenever the computer is 
  727. confused, it either gripes at you or prints a zero. In this 
  728. particular example, it will print a zero, like this:
  729.  0
  730. So if you incorrectly tell the computer to say it loves you, it 
  731. will say zero.
  732.  
  733.          Long commands on small screens
  734.   Try typing this command:
  735. PRINT "I LIKE TO EAT AND DRINK AND GAZE INTO YOUR EYES AS WE 
  736. DREAM ABOUT LOVE"
  737.   That command's long. It won't fit on a single line of your 
  738. screen if your screen's small; but go ahead and type the command 
  739. anyway. When you reach the screen's right edge, the computer 
  740. automatically moves you to the line below so you can continue 
  741. typing. Do not press the ENTER key, until you've typed the entire 
  742. command.
  743.   After typing the entire command, press the ENTER key. The 
  744. computer will print:
  745. I LIKE TO EAT AND DRINK AND GAZE INTO YOUR EYES AS WE DREAM ABOUT 
  746. LOVE
  747.  
  748.  
  749.       EASY PROGRAMS
  750.                                                      Now that 
  751. you've had fun experimenting with the word PRINT, you're ready 
  752. for the big-time; you're ready to program the computer!
  753.  
  754.                                                           Three steps
  755.                                                      Programming 
  756. the computer consists of three steps.
  757.                                                      Step 1: type 
  758. the word NEW That tells the computer you're going to invent a new 
  759. program.
  760.                                                      After you 
  761. type the word NEW, press the ENTER key. The computer will say OK. 
  762. (If your computer is old-fashioned, it will say some other word 
  763. instead, such as READY.)
  764.                                                      Step 2: type 
  765. your program A program is a list of numbered commands. For 
  766. example, suppose you want the computer to say:
  767. I LOVE YOU
  768. YOU TURNED ME ON
  769. LET'S GET MARRIED
  770. Type this program:
  771. 1 PRINT "I LOVE YOU"
  772. 2 PRINT "YOU TURNED ME ON"
  773. 3 PRINT "LET'S GET MARRIED"
  774.                                                      Every line 
  775. of the program must be numbered: you must type those numbers. 
  776. Every line of the program must say PRINT; you must type the word 
  777. PRINT. (Or, if you're too lazy to type the word PRINT, you can 
  778. type a question mark instead.) Every line of that program must 
  779. include quotation marks; you must type the quotation marks.
  780.                                                      At the end 
  781. of each line, press the ENTER key.
  782.                                                      Step 3: type 
  783. the word RUN That tells the computer to look at the program 
  784. you've written, and run through it.
  785.                                                      After you've 
  786. typed the word RUN, press the ENTER key.
  787.                                                      The computer 
  788. will print everything you requested; it will print:
  789. I LOVE YOU
  790. YOU TURNED ME ON
  791. LET'S GET MARRIED
  792.                                                      Then the 
  793. computer will say OK.
  794.                Review
  795.   Let's review that procedure. You type:
  796. NEW
  797. 1 PRINT "I LOVE YOU"
  798. 2 PRINT "YOU TURNED ME ON"
  799. 3 PRINT "LET'S GET MARRIED"
  800. RUN
  801.   The numbered instructions (1, 2, and 3) are called the program. 
  802. Above the program, you type the word NEW; below the program, you 
  803. type the word RUN. The words NEW and RUN are not numbered.
  804.   After you've done all that correctly (and pressed the ENTER key 
  805. after the word RUN), the computer will obey the program and print 
  806. what you requested.
  807.   Each line of the program must be numbered. Putting a number at 
  808. the beginning of a line makes the line become part of your 
  809. program; the computer won't obey the line until the program is 
  810. RUN. Here's the rule: a number in front of the line tells the 
  811. computer to wait until you type the word RUN.
  812.  
  813.            Another example
  814.   For another example, try typing this:
  815. NEW
  816. 1 PRINT "I LONG"
  817. 2 PRINT 2+2
  818. 3 PRINT "U"
  819. RUN
  820.   At the end of each line, remember to press the ENTER key. When 
  821. you press the ENTER key after the word RUN, the computer obeys 
  822. the program.
  823.   The first line makes the computer print ``I LONG''. The second 
  824. line makes the computer add 2 and 2, so the computer prints the 
  825. number 4. The third line makes the computer print the letter U.
  826.   Altogether, the computer prints:
  827. I LONG
  828.  4
  829. U
  830. Yes, the computer says it longs for you!
  831.   In that example, the computer indents the 4, so that the 4 has 
  832. a blank space before it. That's because of this rule: the 
  833. computer automatically puts a blank space before every positive 
  834. number.
  835.   After the computer's finished running that program, if you type 
  836. the word RUN again the computer will print again:
  837. I LONG
  838.  4
  839. U
  840.   A program's a list of numbered instructions. If the program you 
  841. typed isn't on the screen anymore, and you'd like to see that 
  842. list of numbered instructions again, type the word LIST. The 
  843. computer will say:
  844. 1 PRINT "I LONG"
  845. 2 PRINT 2+2
  846. 3 PRINT "U"
  847.  
  848.                                                        Poem
  849.                                          Suppose you want to make 
  850. multiple copies of this poem:
  851. SPRING HAS SPRUNG.
  852. THE GRASS HAS RIZ.
  853. I WONDER WHERE
  854. THE FLOWERS IS.
  855.                                          First, turn the poem 
  856. into a program, by typing:
  857. NEW
  858. 1 PRINT "SPRING HAS SPRUNG."
  859. 2 PRINT "THE GRASS HAS RIZ."
  860. 3 PRINT "I WONDER WHERE"
  861. 4 PRINT "THE FLOWERS IS."
  862. Then type the word RUN (and press the ENTER key). The computer 
  863. will print the poem.
  864.                                          If you type the word RUN 
  865. again, the computer will print the poem again. Each time you type 
  866. the word RUN, the computer will print the poem.
  867.                                          To print many copies of 
  868. the poem, just type the word RUN many times, like this. . . . 
  869. You type:                                        RUN
  870.  
  871. Computer types:                                  SPRING HAS 
  872. SPRUNG.
  873.                                                  THE GRASS HAS 
  874. RIZ.
  875.                                                  I WONDER WHERE
  876.                                                  THE FLOWERS IS.
  877.                                                  OK
  878.  
  879. You type:                                        RUN
  880.  
  881. Computer types:                                  SPRING HAS 
  882. SPRUNG.
  883.                                                  THE GRASS HAS 
  884. RIZ.
  885.                                                  I WONDER WHERE
  886.                                                  THE FLOWERS IS.
  887.                                                  OK
  888.  
  889. You type:                                        RUN
  890.  
  891. Computer types:                                  SPRING HAS 
  892. SPRUNG.
  893.                                                  etc.
  894.                                          If you hate poetry and 
  895. all other forms of art, cheer up: by using the same technique, 
  896. you can make the computer type many copies of your favorite 
  897. flubbed-up business letter or your favorite obnoxious ad.
  898.  
  899.                                                       Colons
  900.                                          You can put several 
  901. statements on the same line, like this:
  902. 1 PRINT "I THINK": PRINT "OF FLEAS": PRINT "AND SNEEZE"
  903.                                          The computer will PRINT 
  904. ``I THINK''. Then the computer will PRINT ``OF FLEAS''. Then the 
  905. computer will PRINT ``AND SNEEZE''. Altogether, the computer will 
  906. print:
  907. I THINK
  908. OF FLEAS
  909. AND SNEEZE
  910.  
  911.           Become an expert
  912.   To invent your own program and make the computer handle it, go 
  913. through the three steps again: type the word NEW, then type your 
  914. program, then type the word RUN. Remember to press the ENTER key 
  915. at the end of each line, and remember that the commands NEW and 
  916. RUN are not numbered.
  917.   Those three steps (NEW then program then RUN) are all you have 
  918. to know about programming! C'mon, write some programs! It's easy! 
  919. Try it. You'll have lots of fun!
  920.   A person who writes a program is called a programmer. 
  921. Congratulations: you're a programmer!
  922.   Write several programs like the ones I've shown you already. 
  923. Then you can put on your résumé that you have ``a wide variety of 
  924. programming experience'', and you can talk your way into a 
  925. programming job!
  926.   The rest of this chapter explains how to become a good 
  927. programmer.
  928.   Programming the computer is like driving a car: the only way to 
  929. become an expert is to put your hands on that mean machine and 
  930. try it yourself.
  931.   If you have access to a computer, put this book next to the 
  932. computer's keyboard. At the end of each paragraph, type the 
  933. examples and look, look, see the computer run. Invent your own 
  934. variations: try typing different numbers and strings. Invent your 
  935. own programs: make the computer print your name or a poem; make 
  936. it solve problems from your other courses and the rest of your 
  937. life. The computer's a fantastic toy. Play with it.
  938.   If you're a student, don't wait for your instructor to give 
  939. lectures and assign homework. Act now. You'll learn more from 
  940. handling the computer than from the lectures or readings. 
  941. Experience counts.
  942.   Let me tell you the story of Charlie. . . . 
  943.   At Wesleyan University's computer center, one of the directors 
  944. was having trouble making the computer print the university's 
  945. payroll. He asked me for help, but I said I didn't know either. I 
  946. saw a little kid sitting at one of the keyboards. ``Hey, 
  947. Charlie,'' I called to him, ``we're having trouble getting the 
  948. payroll out.''
  949.   Little Charlie came over and typed some stuff on our keyboard. 
  950. ``The payroll will be out in a minute,'' he said gleefully.
  951.   Charlie was just in seventh grade. He'd never taken a computer 
  952. course; his school didn't offer one. But by spending the whole 
  953. summer just ``hanging around'' our computer, he knew it better 
  954. than we.
  955.   Be like Charlie. Hang around your computer. Communicate with it 
  956. every day. At first, that will be even harder than talking with a 
  957. cat or a tree, because the computer belongs to a different 
  958. species, a different kingdom; but keep trying. Get to know it as 
  959. well as you know your best friend.
  960.   When dealing with the computer and the people who surround it, 
  961. be friendly but also assertive. To make sure you get your money's 
  962. worth from a computer course, ask your teacher, classmates, lab 
  963. assistants, and other programmers questions, questions, 
  964. questions!
  965.   If you're taking a French course, you might find French 
  966. difficult; and if you're taking a computer course, you might find 
  967. computers difficult also. But even a stupid three-year-old French 
  968. kid can speak French, and even kindergarten kids can program the 
  969. computer. They've got just one advantage over you: practice!
  970.  
  971.           CORRECTING ERRORS
  972.                                          If you make an error, 
  973. you can correct it in three ways. . . . 
  974.                                          If you notice the error 
  975. before you press the ENTER key, correct the error by using the 
  976. BACKSPACE key.
  977.                                          If you mess up the whole 
  978. program, rewrite it, by typing the word NEW and then starting 
  979. from the beginning again.
  980.                                          If you mess up a line, 
  981. retype it underneath. For example, suppose you type ___ 
  982. 1 PRIMT "I LOVE YOU"
  983. and then you notice that you misspelled the word PRINT. Just 
  984. retype the line, so your screen looks like this:
  985. 1 PRIMT "I LOVE YOU"
  986. 1 PRINT "I LOVE YOU"
  987.                                          For another example, 
  988. suppose you type this tongue-twister ___ 
  989. 1 PRINT "SHE SELLS"
  990. 2 PRINT "SEE SHELLS"
  991. 3 PRINT "BY THE SEASHORE"
  992. and then you notice that in line 2, the SEE ought to be SEA. 
  993. Underneath the program, retype that line, so your screen looks 
  994. like this:
  995. 1 PRINT "SHE SELLS"
  996. 2 PRINT "SEE SHELLS"
  997. 3 PRINT "BY THE SEASHORE"
  998. 2 PRINT "SEA SHELLS"
  999. When you type RUN, the computer will run the corrected version 
  1000. and print:
  1001. SHE SELLS
  1002. SEA SHELLS
  1003. BY THE SEASHORE
  1004. When you type LIST, the computer will list the corrected program; 
  1005. the computer will say:
  1006. 1 PRINT "SHE SELLS"
  1007. 2 PRINT "SEA SHELLS"
  1008. 3 PRINT "BY THE SEASHORE"
  1009.  
  1010.                                            What if the computer gripes?
  1011.                                          If the computer ever 
  1012. gripes at you, don't worry: just correct your error.
  1013.                                          For example, suppose you 
  1014. type ___ 
  1015. 1 PRIMT "ROSES ARE RED"
  1016. 2 PRINT "CABBAGE IS GREEN"
  1017. 3 PRINT "MY FACE IS FUNNY"
  1018. 4 PRINT "BUT YOURS IS A SCREAM"
  1019. and you don't notice that you misspelled PRINT in line 1.
  1020.                                          If you type RUN, the 
  1021. computer will try to run the program but will be confused by line 
  1022. 1, so it will gripe at you. It will say:
  1023. SYNTAX ERROR IN 1
  1024. That means the computer hasn't the faintest idea of what you're 
  1025. talking about in line 1.
  1026.                                          Your next step is to 
  1027. correct the error. To do that, just retype line 1 correctly, and 
  1028. then type the word RUN again.
  1029.   So altogether, the conversation looks like this. . . . 
  1030. You type this, but it's wrong:1 PRIMT "ROSES ARE RED"
  1031.                 2 PRINT "CABBAGE IS GREEN"
  1032.                 3 PRINT "MY FACE IS FUNNY"
  1033.                 4 PRINT "BUT YOURS IS A SCREAM"
  1034.                 RUN
  1035.  
  1036. The computer gripes at you:SYNTAX ERROR IN 1
  1037.  
  1038. You type this to correct error:1 PRINT "ROSES ARE RED"
  1039.                 RUN
  1040.  
  1041. The computer recites the poem:ROSES ARE RED
  1042.                 CABBAGE IS GREEN
  1043.                 MY FACE IS FUNNY
  1044.                 BUT YOURS IS A SCREAM
  1045.  
  1046.            Common bloopers
  1047.   If you're like most beginners, you'll make these mistakes soon 
  1048. ___ if you haven't made them already!
  1049.   You type the letter O instead of zero, or type zero instead of 
  1050. the letter O. Your typing looks correct to you, but the computer 
  1051. gripes.
  1052.   You type a command (such as RUN) but forget to press the ENTER 
  1053. key afterwards. The computer keeps waiting for you to press it. 
  1054. Since you don't realize the computer's waiting for you, and since 
  1055. the computer isn't replying, you think the computer broke.
  1056.   You tell the computer to PRINT a message, but you forget to put 
  1057. the message in quotation marks. So the computer gripes or prints 
  1058. a zero instead.
  1059.   You start typing a new program but forget to type the word NEW. 
  1060. So when you type RUN, the computer runs a mishmash of the new 
  1061. program with the previous program and reprints some messages from 
  1062. the previous program.
  1063.  
  1064.       Rearranging your program
  1065.   You don't have to type your program in order.
  1066.   For example, suppose you type:
  1067. 4 PRINT "TOES"
  1068. 2 PRINT "TOAD"
  1069. 3 PRINT "LICKS"
  1070. 1 PRINT "MY"
  1071. In its mind, the computer automatically rearranges the program, 
  1072. so the numbers are in increasing order, like this:
  1073. 1 PRINT "MY"
  1074. 2 PRINT "TOAD"
  1075. 3 PRINT "LICKS"
  1076. 4 PRINT "TOES"
  1077.   If you'd like to peek inside the computer's mind and see what 
  1078. program the computer's thinking of, type the word LIST, like 
  1079. this. . . . 
  1080. You type this program:    4 PRINT "TOES"
  1081.                           2 PRINT "TOAD"
  1082.                           3 PRINT "LICKS"
  1083.                           1 PRINT "MY"
  1084.  
  1085. You type this command:    LIST
  1086.  
  1087. Computer types the program in increasing order:1 PRINT "MY"
  1088.                           2 PRINT "TOAD"
  1089.                           3 PRINT "LICKS"
  1090.                           4 PRINT "TOES"
  1091.   If you type RUN, the computer will print:
  1092. MY
  1093. TOAD
  1094. LICKS
  1095. TOES
  1096.   Whenever you're confused, type the word LIST. Then
  1097. the computer will tell you what's in its mind; and what's in its 
  1098. mind might surprise you!
  1099.                                          Fancy example Type this 
  1100. example and see what happens:
  1101. NEW
  1102. 10 PRINT "MY"
  1103. 90 PRINT "TRUCK"
  1104. 32 PRINT "SNEEZE"
  1105. 50 PRINT "TOE"
  1106. 32 PRINT "NEED A"
  1107. 70
  1108. 80 PRINT "HAT"
  1109. 80
  1110. 20 PRINT "SORE FEET"
  1111.                                          In its mind, the 
  1112. computer rearranges the program to put the numbers in increasing 
  1113. order.
  1114.                                          The lowest number is 10, 
  1115. which prints ``MY''. Next comes line 20, which prints ``SORE 
  1116. FEET''.
  1117.                                          Next comes line 32. 
  1118. Since you typed line 32 twice, the computer assumes you didn't 
  1119. like the first version and want the second version instead, so 
  1120. line 32 prints ``NEED A''.
  1121.                                          Next comes line 40, 
  1122. which prints ``TOE''.
  1123.                                          Next comes line 70. 
  1124. Since line 70 is blank, the computer ignores it.
  1125.                                          Next comes line 80. 
  1126. Since you typed line 80 twice, the computer assumes you didn't 
  1127. like the first version and want the second version instead, which 
  1128. is blank. Since it's blank, the computer ignores it. So the 
  1129. computer ignores line 80 altogether!
  1130.                                          Finally comes line 90, 
  1131. which prints ``TRUCK''.
  1132.                                          If you type LIST, the 
  1133. computer will show you the result of all that reasoning. The 
  1134. computer will type:
  1135. 10 PRINT "MY"
  1136. 20 PRINT "SORE FEET"
  1137. 32 PRINT "NEED A"
  1138. 50 PRINT "TOE"
  1139. 90 PRINT "TRUCK"
  1140.                                          If you type RUN, the 
  1141. computer will print:
  1142. MY
  1143. SORE FEET
  1144. NEED A
  1145. TOE
  1146. TRUCK
  1147.                                          If you think about that 
  1148. example, you'll notice two things:
  1149. To revise a line, just retype it.
  1150.  
  1151. To erase line 80, just type ___ 
  1152. 80
  1153. with nothing else on the line.
  1154.  
  1155.                                                   NEW versus RUN
  1156.                                          The word NEW erases your 
  1157. program from the computer's mind, to make way for a new one.
  1158.                                          But the word RUN does 
  1159. not erase the program. After the run, you can continue inserting, 
  1160. deleting, and revising lines.
  1161.  
  1162.                                                  Numbering by tens
  1163.                                          If your first line is 
  1164. numbered 1, and your second line is numbered 2, you can't squeeze 
  1165. a line between them, since decimals aren't allowed. So expert 
  1166. programmers number their lines 10, 20, 30, 40, . . . instead of 
  1167. 1, 2, 3, . . . 
  1168.                                          That way, if your first 
  1169. line is numbered 10 and your second line is numbered 20, and you 
  1170. want to insert an extra line between them, you can call it 15. If 
  1171. you later want to insert an extra line between 10 and 15, you can 
  1172. call it 12. If you want to insert another line between 10 and 12, 
  1173. you can call it 11.
  1174.            Ranges of lines
  1175.   If your program's too long to fit on your screen, tell the 
  1176. computer to list part of your program.
  1177.   For example, to list just line 30, type this:
  1178. LIST 30
  1179.   To list lines 30 through 80, type this:
  1180. LIST 30-80
  1181. To list from line 30 to the end of your program, type this:
  1182. LIST 30-
  1183. To list from the beginning of your program up to line 80, type 
  1184. this:
  1185. LIST -80
  1186.   To delete lines 30 through 80, type this:
  1187. DELETE 30-80
  1188. That works on most computers. Some computers are different; check 
  1189. the ``Versions of BASIC'' appendix.
  1190.  
  1191.              Arrow keys
  1192.   To correct a mistake in your program quickly, try using the 
  1193. arrow keys. Here's how.
  1194.   See the error Make sure the line you want to correct is on the 
  1195. screen. If it's not on the screen yet, put it onto the screen by 
  1196. using the word LIST or EDIT.
  1197.   For example, to put line 30 onto the screen, type ___ 
  1198. LIST 30
  1199. or type:
  1200. EDIT 30
  1201.   Move to the error On the keyboard, you'll see a key that shows 
  1202. an arrow pointing to the left; it's called the left-arrow key. 
  1203. You'll also see a key that shows an arrow pointing to the right; 
  1204. it's called the right-arrow key. You'll also see an up-arrow key 
  1205. and a down-arrow key.
  1206.   On the computer's screen, you'll see a little blinking 
  1207. rectangle, called the cursor. Move it to the part of the line you 
  1208. want to correct, by pressing the arrow keys. (To move the cursor 
  1209. to the left, press the left-arrow key; to move the cursor to the 
  1210. right, press the right-arrow key; to move the cursor up, press 
  1211. the up-arrow key; to move the cursor down, press the down-arrow 
  1212. key.)
  1213.   If you typed the word LIST, you must press the up-arrow key to 
  1214. move the cursor up to the line you want to correct. If you typed 
  1215. the word EDIT instead, you don't need to press the up-arrow key; 
  1216. the word EDIT puts the cursor on the correct line automatically.
  1217.   Correct the error When you've moved the cursor to the part of 
  1218. the line you want to correct, make your corrections.
  1219.   To delete a character, move the cursor to that character, then 
  1220. press the DELETE key. To replace a character, move the cursor to 
  1221. that character, then type the new character you want instead. To 
  1222. insert extra characters in the middle of the line, move the 
  1223. cursor where you want the extra characters to begin, press the 
  1224. INSERT key, then type the extra characters.
  1225.   When you've finished correcting the line, press the ENTER key, 
  1226. which tells the computer to take the corrections seriously.
  1227.   Final comments After pressing the ENTER key, if you want to 
  1228. move the cursor to the bottom of the screen, press the down-arrow 
  1229. key several times.
  1230.   That method of editing works on most computers. To find out how 
  1231. to edit easily on your computer, read the appendix.
  1232.  
  1233.            TRICKY PRINTING
  1234.                                          Printing can be tricky! 
  1235. Here are the tricks. . . . 
  1236.  
  1237.                                                     Semicolons
  1238.                                          Run this program:
  1239. 10 PRINT "FAT";
  1240. 20 PRINT "HER"
  1241.                                          Line 10 makes the 
  1242. computer print FAT; and line 10 ends with a semicolon. The 
  1243. semicolon makes the computer print the next item on the same 
  1244. line; so the computer will print HER on the same line, like this:
  1245. FATHER
  1246.                                          This command shows what 
  1247. happens to an evil king on a boat:
  1248. PRINT "SIN";"KING"
  1249. The computer will print SIN, and will print KING on the same 
  1250. line, like this:
  1251. SINKING
  1252.  
  1253.  
  1254.                                                     Blank lines
  1255.                                          Life consists sometimes 
  1256. of joy, sometimes of sorrow, and sometimes of a numb emptiness. 
  1257. To express those feelings, run this program:
  1258. 10 PRINT "JOY"
  1259. 20 PRINT
  1260. 30 PRINT "SORROW"
  1261.                                          Line 10 makes the 
  1262. computer print JOY. Line 20 makes the computer print a blank 
  1263. empty line, underneath JOY. Altogether, the computer will print:
  1264. JOY
  1265.  
  1266. SORROW
  1267.  
  1268.                                                      Indenting
  1269.                                          Suppose you want the 
  1270. computer to print this letter:
  1271. DEAR JOAN,
  1272.   THANK YOU FOR THE BEAUTIFUL
  1273. NECKTIE.  JUST ONE PROBLEM--
  1274. I DON'T WEAR NECKTIES!
  1275.               LOVE,
  1276.               FRED-THE-HIPPIE
  1277.                                          This program prints it:
  1278. 10 PRINT "DEAR JOAN,"
  1279. 20 PRINT "  THANK YOU FOR THE BEAUTIFUL"
  1280. 30 PRINT "NECKTIE.  JUST ONE PROBLEM--"
  1281. 40 PRINT "I DON'T WEAR NECKTIES!"
  1282. 50 PRINT "              LOVE,"
  1283. 60 PRINT "              FRED-THE-HIPPIE"
  1284.                                          In the program, each 
  1285. line contains two quotation marks. To make the computer indent a 
  1286. line, put blank spaces after the first quotation mark.
  1287.  
  1288.                                                Spaces after numbers
  1289.                                          Try typing this command:
  1290. PRINT -3;"IS MY FAVORITE NUMBER"
  1291. Whenever the computer prints a number, it prints a blank space 
  1292. afterwards; so the computer will print a blank space after -3, 
  1293. like this:
  1294. -3 IS MY FAVORITE NUMBER
  1295.   
  1296.  space
  1297.  
  1298.         Spaces before numbers
  1299.   This command tells what to put in your coffee:
  1300. PRINT 7;"DO";"NUTS"
  1301. The computer prints 7 and DO and NUTS. Since 7 is a number, the 
  1302. computer prints a blank space after the 7. The computer prints 
  1303. another blank space before every number that's positive; so the 
  1304. computer prints another blank space before the 7, like this:
  1305.  7 DONUTS
  1306.  
  1307. spaces
  1308.   Hey, if you're feeling cool, maybe this command expresses your 
  1309. feelings:
  1310. PRINT "THE TEMPERATURE IS";4+25;"DEGREES"
  1311. The computer prints THE TEMPERATURE IS, then 4+25 (which is 29), 
  1312. then DEGREES. Since 29 is a positive number, the computer prints 
  1313. a blank space before and after the 29:
  1314. THE TEMPERATURE IS 29 DEGREES
  1315.                     
  1316.                              spaces
  1317.   Use this command if you're even colder:
  1318. PRINT "THE TEMPERATURE IS";4-25;"DEGREES"
  1319. The computer prints THE TEMPERATURE IS, then 4-25 (which is -21), 
  1320. then DEGREES. Since -21 is a number, the computer prints a space 
  1321. after it; but since -21 is not positive, the computer does not 
  1322. print a space before it. The computer prints:
  1323. THE TEMPERATURE IS-21 DEGREES
  1324.                     
  1325.                    no space    space
  1326.   Yuk! That looks ugly! It would look prettier if there were a 
  1327. space before the -21. To insert a space, put the space inside 
  1328. quotation marks:
  1329. PRINT "THE TEMPERATURE IS ";4-25;"DEGREES"
  1330.                          
  1331.                                  inserted space, before the 
  1332. quotation mark
  1333. Then the computer will print:
  1334. THE TEMPERATURE IS -21 DEGREES
  1335.                   
  1336.                       inserted space
  1337.  
  1338.         Multiple calculations
  1339.   By using semicolons, you can make the computer do many 
  1340. calculations at once.
  1341.   For example, this command makes the computer do 6+2, 6-2, 6*2, 
  1342. and 6/2, all at once:
  1343. PRINT 6+2;6-2;6*2;6/2
  1344. That makes the computer print the four answers:
  1345.  8  4  12  3
  1346. The computer prints spaces between the answers, because the 
  1347. computer prints a space after every number (and an additional 
  1348. space before every number that's positive).
  1349.  
  1350.           Clear the screen
  1351.   If you press the CLEAR key (which is on the Walter keyboard), 
  1352. the computer erases the entire screen, so that the screen becomes 
  1353. cleared, empty, blank.
  1354.   Though pressing the CLEAR key erases the screen, it does not 
  1355. erase the computer's memory. The computer still remembers what 
  1356. program you were working on. The only way to erase the computer's 
  1357. memory is to type the word NEW.
  1358.                                          So whenever you want to 
  1359. begin a new program, type the word NEW, which erases the previous 
  1360. program; pressing the CLEAR key is not sufficient.
  1361.                                          You can begin your 
  1362. program with this line:
  1363. 10 CLS
  1364. It makes the computer automatically CLear the Screen, before 
  1365. doing the rest of the program.
  1366.                                          For example, run this 
  1367. program:
  1368. 10 CLS
  1369. 20 PRINT "I'M SITTING ON TOP OF THE WORLD"
  1370. Line 10 makes the computer CLear the Screen. Since the screen's 
  1371. been cleared, line 20 prints this message at the top of the 
  1372. screen:
  1373. I'M SITTING ON TOP OF THE WORLD
  1374.                                          On older computers, the 
  1375. CLEAR key is missing and the CLS command doesn't work. To find 
  1376. out about your computer, see the ``Versions of BASIC'' appendix.
  1377.  
  1378.                                                   Print on paper
  1379.                                          You've learned how to 
  1380. make the computer print messages, poems, and business letters on 
  1381. your screen. But if you want to mail those messages and letters 
  1382. to your friends, you face this problem: the post office refuses 
  1383. to mail your screen! And it's hard to stuff your screen into an 
  1384. envelope! So to mail the computer's wise words to your friends, 
  1385. you must tell the computer to print on paper instead of on the 
  1386. screen.
  1387.                                          To make the computer 
  1388. print on paper, attach the computer to a printer, which handles 
  1389. paper and looks like a typewriter without a keyboard.
  1390.                                          You can control the 
  1391. printer in four ways.
  1392.                                          The PRINT key The 
  1393. simplest way is to press the PRINT key, which is on the Walter 
  1394. keyboard. Pressing the PRINT key makes the printer dump onto 
  1395. paper a snapshot of everything that's on the screen. The snapshot 
  1396. on paper is called a screen dump.
  1397.                                          The ECHO key A fancier 
  1398. way to print on paper is to press the ECHO key, which is also on 
  1399. the Walter keyboard. Pressing the ECHO key turns your entire 
  1400. computer system into a gigantic typewriter. After you press the 
  1401. ECHO key, whatever you or the computer type onto the screen will 
  1402. also be echoed onto the paper. For example, if you press the ECHO 
  1403. key and then type the word LOVE, the word LOVE will appear on 
  1404. both the screen and the paper. The printer will continue to echo 
  1405. everything that's typed, until you tell the printer to stop 
  1406. echoing. To tell the printer to stop, just press the ECHO key 
  1407. again.
  1408.                                          The LPRINT command If 
  1409. you type LPRINT instead of PRINT, the computer will print on 
  1410. paper instead of on the screen. For example, to make the computer 
  1411. print I LOVE YOU on paper, type this:
  1412. LPRINT "I LOVE YOU"
  1413.                                          The LLIST command To 
  1414. list your program on paper, instead of on the screen, type an 
  1415. extra L in front of the word LIST, like this:
  1416. LLIST
  1417.                                          Differences Although 
  1418. modern computers include a PRINT key and an ECHO key and 
  1419. understand LPRINT and LLIST, older computers do not. To find out 
  1420. about your computer, read the ``Versions of BASIC'' appendix.
  1421.  
  1422.     GOING & STOPPING
  1423.   You can tell the computer to go and stop.
  1424.  
  1425.           GO TO
  1426.   This program makes the computer go wild:
  1427. 10 PRINT "CAT"
  1428. 20 PRINT "DOG"
  1429. 30 GO TO 10
  1430.   Line 10 makes the computer print CAT. Line 20 makes it print 
  1431. DOG.
  1432.   Line 30 makes it go back to line 10 again, so it prints CAT 
  1433. again. Then it prints DOG again, and comes to line 30 again, 
  1434. which makes it go back to line 10 again, print CAT and DOG again, 
  1435. and then jump back again. . . . 
  1436.   The computer will print the words CAT and DOG again and again, 
  1437. like this:
  1438. CAT
  1439. DOG
  1440. CAT
  1441. DOG
  1442. CAT
  1443. DOG
  1444. CAT
  1445. DOG
  1446. CAT
  1447. DOG
  1448. etc.
  1449. The computer will try to print the words CAT and DOG again and 
  1450. again, forever.
  1451.   Try running that program; you'll have fun watching the computer 
  1452. go crazy. The computer will print the words CAT and DOG on every 
  1453. line of your screen; and even when all the lines of your screen 
  1454. have been used, the computer still doesn't stop: all the CATs and 
  1455. DOGs rise to the top of the screen and finally off the screen, to 
  1456. make way for new CATs and DOGs to appear at the bottom of the 
  1457. screen. You'll see a blur, as thousands of CATs and DOGs go 
  1458. flying up the screen.
  1459.   If you told the computer to use the printer (which prints on 
  1460. paper), you'll see reams of paper spewing out, saying CAT and 
  1461. DOG. Soon your whole room will be buried under piles of paper 
  1462. saying CAT and DOG thousands of times!
  1463.                              To stop this madness, you must give 
  1464. the computer some kind of ``jolt'' that will put it out of its 
  1465. misery. And now we come to the controversial part of this book. 
  1466. To put the computer out of its misery, you must give an abortion. 
  1467. To give the abortion, press the BREAK key. That makes the 
  1468. computer stop running your program; it will abort your program 
  1469. and say OK. Then you can give any command, such as LIST.
  1470.                              (The BREAK key is on the Walter 
  1471. keyboard. To find out about your computer's keyboard, check the 
  1472. ``Versions of BASIC'' appendix.)
  1473.                              Here's a picture of that program:
  1474.    start
  1475.  
  1476.    10 PRINT "CAT"
  1477.  
  1478.    20 PRINT "DOG"
  1479.  
  1480.    30 GO TO 10
  1481. The computer follows the arrows, which make it go round and round 
  1482. in a loop. Since the computer will try to go round and round the 
  1483. loop forever, the loop is called infinite. The only way to stop 
  1484. an infinite loop is to abort it.
  1485.                              In that program, you typed just 
  1486. three lines; but since the third line said to GO TO the 
  1487. beginning, the computer does an infinite loop. By saying GO TO, 
  1488. you can make the computer do an infinite amount of work. Moral: 
  1489. the computer can turn a finite amount of human energy into an 
  1490. infinite amount of good. Putting it another way: the computer can 
  1491. multiply your abilities by infinity.
  1492.  
  1493.                                                  Love
  1494.                              Let's spread love throughout the 
  1495. world! Type this program, which makes the computer multiply your 
  1496. love:
  1497. 10 PRINT "LOVE"
  1498. 20 GO TO 10
  1499.                              Even though you typed the word LOVE 
  1500. just once, the computer will print it many times, like this:
  1501. LOVE
  1502. LOVE
  1503. LOVE
  1504. LOVE
  1505. LOVE
  1506. etc.
  1507. The computer will print repeatedly, until you abort its love.
  1508.                              For more lovely fun, put a semicolon 
  1509. after LOVE, like this:
  1510. 10 PRINT "LOVE";
  1511. 20 GO TO 10
  1512. The semicolon makes the computer print LOVE next to LOVE:
  1513. LOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVEL
  1514. OVELOVELOVELOVE
  1515. LOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVEL
  1516. OVELOVELOVELOVE
  1517. LOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVELOVEL
  1518. OVELOVELOVELOVE
  1519. etc.
  1520.                              If you put a space after LOVE, like 
  1521. this ___ 
  1522. 10 PRINT "LOVE ";
  1523. 20 GO TO 10
  1524. the computer will put a space after each LOVE:
  1525. LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE 
  1526. LOVE LOVE LOVE
  1527. LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE 
  1528. LOVE LOVE LOVE
  1529. LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE LOVE 
  1530. LOVE LOVE LOVE
  1531. etc.
  1532.                              Instead of making the computer print 
  1533. LOVE, try making it print an ad (such as BUY JOE'S MEAT), or 
  1534. political slogan (such as STOP POLLUTION), or your name, or 
  1535. something else you feel emotional about. Like a dog, the computer 
  1536. imitates its master's personality. If your computer acts ``cold 
  1537. and heartless'', it's because you are!
  1538.             Smelly poetry
  1539.   Suppose you want to send this poem to all your friends:
  1540. I'M HAVING TROUBLE
  1541. WITH MY NOSE.
  1542. THE ONLY THING IT DOES IS:
  1543. BLOWS!
  1544.   Just run this program:
  1545. 10 PRINT "I'M HAVING TROUBLE"
  1546. 20 PRINT "WITH MY NOSE."
  1547. 30 PRINT "THE ONLY THING IT DOES IS:"
  1548. 40 PRINT "BLOWS!"
  1549. 50 PRINT
  1550. 60 GO TO 10
  1551.   Lines 10-40 print the poem. Line 50 prints a blank line at the 
  1552. end of the poem. Line 60 makes the computer do all that 
  1553. repeatedly, so the computer will print:
  1554. I'M HAVING TROUBLE
  1555. WITH MY NOSE.
  1556. THE ONLY THING IT DOES IS:
  1557. BLOWS!
  1558.  
  1559. I'M HAVING TROUBLE
  1560. WITH MY NOSE.
  1561. THE ONLY THING IT DOES IS:
  1562. BLOWS!
  1563.  
  1564. I'M HAVING TROUBLE
  1565. WITH MY NOSE.
  1566. THE ONLY THING IT DOES IS:
  1567. BLOWS!
  1568.  
  1569. etc.
  1570.   The computer will print infinitely many copies of the poem ___ 
  1571. unless you abort it. If you activate the computer's printer, the 
  1572. copies will be printed on paper, so you can mail them to your 
  1573. nosy friends.
  1574.  
  1575.       Life as an infinite loop
  1576.   A program that makes the computer do the same thing again and 
  1577. again forever is an infinite loop.
  1578.   Some humans act just like computers. Those humans do the same 
  1579. thing again and again. Every morning they GO TO work, and every 
  1580. evening they GO TO home. GO TO work, GO TO home, GO TO work, GO 
  1581. TO home, . . . Their lives are sheer drudgery. They're caught in 
  1582. an infinite loop.
  1583.   Go to your bathroom, get your bottle of shampoo, and look at 
  1584. the instructions on the back. A typical bottle has three 
  1585. instructions:
  1586. Lather.
  1587. Rinse.
  1588. Repeat.
  1589. Those instructions say to lather, then rinse, then repeat ___ 
  1590. which means to lather again, then rinse again, then repeat again 
  1591. ___ which means to lather again, then rinse again, then repeat 
  1592. again. . . . If you follow those instructions, you'll never 
  1593. finish washing your hair! The instructions are an infinite loop! 
  1594. The instructions are a program: they program you to use lots of 
  1595. shampoo! That's how infinite loops help sell shampoo.
  1596.                                                   Infinite pause
  1597.                                          This program tortures 
  1598. the computer:
  1599. 10 GO TO 10
  1600.                                          Line 10 tells the 
  1601. computer to go to line 10, which tells the computer to go to line 
  1602. 10, which tells the computer to go to line 10. . . . The computer 
  1603. will do line 10 again and again, forever. So the computer will 
  1604. spend the rest of its life just mumbling to itself. That program 
  1605. has turned your beautiful computer into a bumbling, mumbling 
  1606. idiot.
  1607.                                          The ``10 GO TO 10'' is 
  1608. called an infinite pause, because it makes the computer pause 
  1609. from doing all useful work, forever.
  1610.                                          If you're mean enough to 
  1611. give your computer that program, please abort it! Otherwise, a 
  1612. member of the Association for Prevention of Cruelty to Computers 
  1613. will stick pins in your voodoo doll.
  1614.                                          To make the program even 
  1615. meaner, insert line 5, like this:
  1616. 5 CLS
  1617. 10 GO TO 10
  1618. Line 5 makes the computer CLear the Screen, so that the whole 
  1619. screen becomes blank. And line 10 renders the computer completely 
  1620. useless: the computer will ignore anything you type, since the 
  1621. computer is busy doing ``10 GO TO 10'' forever. Now you have a 
  1622. computer whose screen is permanently blank and that ignores 
  1623. anything you type on the keyboard! To get really mean, walk up to 
  1624. your best friend's computer, type that program, type the word 
  1625. RUN, and watch your friend suffer when the screen and keyboard 
  1626. both stop working! (And see how long your friend remains your 
  1627. ``friend''!) The only way your (ex-)friend can fix the computer 
  1628. is to give an abortion or turn off the power.
  1629.                                          (Remember: most 
  1630. computers understand CLS, but yours might not. To find out about 
  1631. your computer, check the ``Versions of BASIC'' appendix.)
  1632.                                          To elaborate on that 
  1633. program, add line 7, like this:
  1634. 5 CLS
  1635. 7 PRINT "I REFUSE TO WORK FOR YOU"
  1636. 10 GO TO 10
  1637. When you RUN that program, the screen goes blank, then the 
  1638. computer says it refuses to work for you, and then line 10 does 
  1639. indeed make the computer refuse to work for you! The computer 
  1640. will refuse all your work ___ it'll just mumble to itself ___ 
  1641. until you give it an abortion.
  1642.                                          Now that I've turned you 
  1643. into a computer saboteur, the whole world will worry that you'll 
  1644. kidnap computers, hold them hostage, and threaten to turn them 
  1645. into ``10 GO TO 10'' idiots! You can even cause a moral dilemma 
  1646. for people who are against abortions and are even more against 
  1647. ``pulling the plug''. Is God against abortions for computers?
  1648.           How to skip ahead
  1649.   Did you ever dream about having a picnic in the woods? This 
  1650. program expresses that dream:
  1651. 10 PRINT "LET'S MUNCH"
  1652. 20 PRINT "SANDWICHES UNDER"
  1653. 30 PRINT "THE TREES"
  1654. It makes the computer print:
  1655. LET'S MUNCH
  1656. SANDWICHES UNDER
  1657. THE TREES
  1658.   Let's turn that dream into a nightmare, in which we all become 
  1659. giant termites. To do that, insert the shaded line:
  1660. 10 PRINT "LET'S MUNCH"
  1661. 15 GO TO 30
  1662. 20 PRINT "SANDWICHES UNDER"
  1663. 30 PRINT "THE TREES"
  1664. The computer does line 10, which prints LET'S MUNCH. Then it does 
  1665. line 15, which makes it skip ahead to line 30, which prints THE 
  1666. TREES. So altogether, the computer prints:
  1667. LET'S MUNCH
  1668. THE TREES
  1669.   In that program, line 15 made the computer skip ahead to line 
  1670. 30 and skip over line 20.
  1671.  
  1672.                  END
  1673.   To make the computer skip the bottom part of your program, say 
  1674. END:
  1675. 10 PRINT "SHE SMELLS"
  1676. 20 END
  1677. 30 PRINT "OF PERFUME"
  1678. The computer will print SHE SMELLS and then end, without printing 
  1679. OF PERFUME.
  1680.   After the computer ends, it'll say OK. Then you can type any 
  1681. command, such as LIST (to see the program again) or RUN (to make 
  1682. the computer print SHE SMELLS again) or NEW (to create a new 
  1683. program).
  1684.  
  1685.                 STOP
  1686.   Instead of saying END, you can say STOP, like this:
  1687. 10 PRINT "SHE SMELLS"
  1688. 20 STOP
  1689. 30 PRINT "OF PERFUME"
  1690. The computer will print SHE SMELLS and then stop, without 
  1691. printing OF PERFUME.
  1692.   When the computer encounters the word STOP, it prints a message 
  1693. telling you which line said STOP.
  1694.   For example, when the computer stops because line 20 said STOP, 
  1695. the computer prints ``STOPPED AT LINE 20'' or ``BREAK IN LINE 
  1696. 20'' or ``BREAK IN 20''. (The exact wording depends on which 
  1697. computer you bought.)
  1698.   So if you type ___ 
  1699. 10 PRINT "SHE SMELLS"
  1700. 20 STOP
  1701. 30 PRINT "OF PERFUME"
  1702. and then type RUN, the computer will print something like this:
  1703. SHE SMELLS
  1704. BREAK IN 20
  1705.  
  1706.  
  1707.          DISKS VERSUS TAPES
  1708.                                          While you're working 
  1709. with a program, the computer keeps the program in its 
  1710. random-access memory (RAM). In a typical microcomputer, the RAM 
  1711. handles just one program at a time. If you want the computer to 
  1712. remember several programs, you can put one program in the RAM but 
  1713. must put the remaining programs on a disk or tape instead.
  1714.  
  1715.                                                    Save on disk
  1716.                                          Here's how to use a 
  1717. disk. (I'll explain tape later.)
  1718.                                          Before typing your 
  1719. program, make sure the computer and disk have both been properly 
  1720. prepared. To find out how to prepare your computer and disk, read 
  1721. the ``Versions of BASIC'' appendix.
  1722.                                          Then type your program. 
  1723. For example, try typing this program:
  1724. NEW
  1725. 10 PRINT "MY DAD"
  1726. 20 PRINT "IS GLAD"
  1727.                                          Underneath the program, 
  1728. try typing this:
  1729. SAVE "JOE"
  1730. That makes the computer copy the program from the RAM to the 
  1731. disk, and name the program JOE.
  1732.                                          Copying from the RAM to 
  1733. the disk is called ``saving'' the program. SAVE ``JOE'' means: 
  1734. save the program and name it ``JOE''.
  1735.                                          Altogether, here's what 
  1736. you typed:
  1737. NEW
  1738. 10 PRINT "MY DAD"
  1739. 20 PRINT "IS GLAD"
  1740. SAVE "JOE"
  1741.                                          (On your computer, the 
  1742. procedure might be slightly different: check the ``Versions of 
  1743. BASIC'' appendix.)
  1744.                                          To make sure the 
  1745. computer copied the program onto the disk, type this word:
  1746. FILES
  1747. The computer will print the names of all the programs on the 
  1748. disk, and one of the names it will print is JOE.
  1749.                                          The program is now in 
  1750. two places: the program's original version is still in the RAM, 
  1751. and a copy of it is on the disk. The copy is called JOE.
  1752.                                          If you type NEW, you'll 
  1753. erase the RAM, and so the program won't be in the RAM anymore. 
  1754. But although the program's original version is no longer in the 
  1755. RAM, the copy (which is called JOE) remains on the disk. To prove 
  1756. JOE's still on the disk, type the word FILES again, which makes 
  1757. the computer say again that JOE's still on the disk.
  1758.         How to choose a name
  1759.   If you don't like the name JOE, choose a different name 
  1760. instead. For example, to create a program named SUE, type a 
  1761. program and then say:
  1762. SAVE "SUE"
  1763.   The name of your program can be ``JOE'' or ``SUE'' or any other 
  1764. brief string of letters and digits. For example, it can be 
  1765. ``LOVER'' or ``POEM4U''.
  1766.   Pick a name that reminds you of the program's purpose. For 
  1767. example, if the program prints a bill to a customer, call the 
  1768. program ``BILL''; if the program plays chess, call the program 
  1769. ``CHESS''; if it gives a quiz, call it ``QUIZ''; if it tutors a 
  1770. human about the elements of sex, call it ``SEX''; if it tutors a 
  1771. human about advanced sex, call it ``SEX2''.
  1772.  
  1773.            Load from disk
  1774.   You've seen that the word SAVE makes the computer copy a 
  1775. program from the RAM to the disk. The opposite of the word SAVE 
  1776. is the word LOAD: it makes the computer copy a program from the 
  1777. disk to the RAM.
  1778.   For example, if you want the computer to copy JOE from the disk 
  1779. to the RAM, type this:
  1780. LOAD "JOE"
  1781. It tells the computer to load JOE into the RAM (from the disk). 
  1782. After typing that, the program's in the RAM again. To prove it's 
  1783. in the RAM, type the word LIST, so that the computer will LIST 
  1784. the program that's in the RAM; or type the word RUN, which makes 
  1785. the computer RUN the program that's in the RAM.
  1786.   So if JOE's on a disk, you can run it by first copying it to 
  1787. the RAM and then saying RUN, like this:
  1788. LOAD "JOE"
  1789. RUN
  1790.   Instead of typing that pair of lines, you can type this single 
  1791. line, which is a short-cut:
  1792. RUN "JOE"
  1793. That makes the computer automatically load JOE (from the disk to 
  1794. the RAM) and run it.
  1795.  
  1796.             Edit the disk
  1797.   Suppose you don't like the version of JOE that's on the disk. 
  1798. Here's how to revise JOE.
  1799.   First, copy JOE from the disk to the RAM, by saying:
  1800. LOAD "JOE"
  1801.   Then examine the program, by typing:
  1802. LIST
  1803.   Then revise the program, by retyping some of its lines or 
  1804. adding new ones.
  1805.   When you've finished revising the program's version that's in 
  1806. the RAM, copy the revisions from the RAM to disk, by saying 
  1807. again:
  1808. SAVE "JOE"
  1809. That command makes the computer copy the revised version of JOE 
  1810. onto the disk (and erases the previous version of JOE from the 
  1811. disk).
  1812.   If JOE's on the disk and you want to change its name to FRED, 
  1813. type this:
  1814. RENAME "JOE" TO "FRED"
  1815.  
  1816.                                                  Protect yourself
  1817.                                          Suppose you're creating 
  1818. a program named TOM, which is so long that it takes you several 
  1819. hours to type. You'll be upset if, after several hours of typing, 
  1820. your town suddenly has a blackout that makes the computer forget 
  1821. what you typed.
  1822.                                          To protect yourself 
  1823. against such a calamity, type SAVE ``TOM'' every fifteen minutes. 
  1824. Then if your town has a blackout, you'll lose just a few minutes 
  1825. of work; the rest of your work will have already been saved on a 
  1826. disk.
  1827.                                          Typing SAVE ``TOM'' 
  1828. every fifteen minutes protects you against blackouts and also 
  1829. against ``computer malfunction'' and any careless errors you 
  1830. might make.
  1831.                                          Each time you say SAVE 
  1832. ``TOM'', the computer puts a copy of the program onto the disk 
  1833. and saves that copy permanently ___ or at least until you type 
  1834. SAVE ``TOM'' again fifteen minutes later. Even if your RAM is 
  1835. erased (by a blackout or computer malfunction or your 
  1836. carelessness), TOM will still be on the disk.
  1837.  
  1838.                                                  Space on the disk
  1839.                                          If you invent many 
  1840. programs and put them on the disk, the disk will someday become 
  1841. full. If you try to put more programs onto the disk than the disk 
  1842. can hold, the computer will gripe by printing a message such as:
  1843. DISK FULL
  1844.                                          Someday, you'll decide 
  1845. you no longer have any use for JOE, and that JOE's just wasting 
  1846. space on your disk. To erase JOE from the disk, type this:
  1847. KILL "JOE"
  1848.  
  1849.                                                        Tapes
  1850.                                          If you can't afford a 
  1851. disk drive, try using cassette tapes instead, which serve the 
  1852. same purpose as disks but are cheaper and slower. (To find out 
  1853. whether your computer accepts cassette tapes, check the 
  1854. ``Versions of BASIC'' appendix.)
  1855.                                          Here's how to put a 
  1856. program onto a cassette tape. First, type the program. Then put a 
  1857. tape into the tape recorder; to do that, you might have to press 
  1858. the recorder's EJECT button.
  1859.                                          Rewind the tape, by 
  1860. pressing the recorder's REWIND button. When the tape is rewound, 
  1861. press the recorder's STOP button.
  1862.                                          If the recorder has a 
  1863. counter, press the counter's button, so the counter becomes zero.
  1864.                                          Press the recorder's 
  1865. FAST FORWARD button, until you get to a part of the tape that's 
  1866. blank and good. (The very beginning of the tape is bad. Wait 
  1867. until the counter gets to at least 10.) Then press the STOP 
  1868. button.
  1869.                                          If the recorder has a 
  1870. counter, notice the counter's number, and write it onto the 
  1871. tape's label, by using a pencil.
  1872.                                          To find out what to do 
  1873. next, read the ``Versions of BASIC'' appendix, which explains the 
  1874. peculiarities of your computer!